//
//  CellOfSpecial.m
//  project-A (pianke)
//
//  Created by dllo on 16/2/29.
//  Copyright © 2016年 scott. All rights reserved.
//

#import "CellOfSpecial.h"
#import "ModelOfSpecial.h"
#import <UIImageView+WebCache.h>
#import <DKNightVersion.h>
#define WIDTH [UIScreen mainScreen].bounds.size.width

@interface CellOfSpecial ()
@property (nonatomic,retain)UILabel *label_name;

@property (nonatomic,retain)UILabel *label_title;

@property (nonatomic,retain)UIImageView *imgBack;


@end
@implementation CellOfSpecial

-(void)dealloc{
    [_label_name release];
    [_label_title release];
    [_imgBack release];
    [super dealloc];
    
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatViews];
    }
    return self;
}

-(void)creatViews{
    
    self.imgBack = [[UIImageView alloc]init];
    [self.contentView addSubview:self.imgBack];
    
    
    [self.imgBack release];
    
    

    self.label_name = [[UILabel alloc]init];
    
    self.label_name.textColor = [UIColor whiteColor];
    self.label_name.font = [UIFont fontWithName:@"Arial-BoldMT" size:28];
    
    self.label_name.dk_textColorPicker  = DKColorWithColors([UIColor whiteColor], [UIColor colorWithRed:0.64 green:0.74 blue:0.86 alpha:1]);
    
    [self.contentView addSubview:self.label_name];
    [self.label_name release];
    
    self.label_title = [[UILabel alloc]init];
    
    self.label_title.textColor = [UIColor whiteColor];
    self.label_title.font = [UIFont fontWithName:@"Arial-BoldMT" size:18];
    
    self.label_title.dk_textColorPicker  = DKColorWithColors([UIColor whiteColor], [UIColor colorWithRed:0.16 green:0.14 blue:0.13 alpha:1]);

    
    [self.contentView addSubview:self.label_title];
    [self.label_title release];
    
    
    
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.imgBack.frame = CGRectMake(10, 5, WIDTH - 20, (WIDTH - 20)*0.7);
    self.label_name.frame = CGRectMake(30, (WIDTH - 30)*0.7 - 70, WIDTH - 60, 30);
    self.label_title.frame = CGRectMake(30, (WIDTH - 30)*0.7 - 30, WIDTH - 60, 20);

}

-(void)pass:(ModelOfSpecial *)model{
    
    [self.imgBack sd_setImageWithURL:[NSURL URLWithString:model.image_url] placeholderImage:nil options:SDWebImageProgressiveDownload];
    self.label_title.text = model.title;
    self.label_name.text = model.name;
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
